<?php /* Smarty version 3.1.27, created on 2016-10-16 05:10:35
         compiled from "C:\wamp\www\homework\winterboy\mvc\views\User\index.html" */ ?>
<?php
/*%%SmartyHeaderCode:238615802efabee5ef1_63747034%%*/
if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '623756cf2daf280805395cb7c96de12236665a39' => 
    array (
      0 => 'C:\\wamp\\www\\homework\\winterboy\\mvc\\views\\User\\index.html',
      1 => 1476587433,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '238615802efabee5ef1_63747034',
  'variables' => 
  array (
    'title' => 0,
    'list' => 0,
    'v' => 0,
  ),
  'has_nocache_code' => false,
  'version' => '3.1.27',
  'unifunc' => 'content_5802efac04f928_33147624',
),false);
/*/%%SmartyHeaderCode%%*/
if ($_valid && !is_callable('content_5802efac04f928_33147624')) {
function content_5802efac04f928_33147624 ($_smarty_tpl) {

$_smarty_tpl->properties['nocache_hash'] = '238615802efabee5ef1_63747034';
?>
<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title><?php echo $_smarty_tpl->tpl_vars['title']->value;?>
</title>
    <link rel="stylesheet" href="./public/css/bootstrap.min.css">
    <link rel="stylesheet" href="./public/my.css">
</head>
<body>
    <div class="container">
        <h1><span class="glyphicon glyphicon-user"></span> <?php echo $_smarty_tpl->tpl_vars['title']->value;?>
</h1>
        <div class="center-block mt20">
            <a href="./index.php?c=User&a=index" class="btn btn-info">首页</a>
            <a href="./index.php?c=User&a=add" class="btn btn-success">添加</a>
        </div>
        
        <table class="table table-hover mt20">
            <tr>
                <td>ID</td>
                <td>姓名</td>
                <td>性别</td>
                <td>年龄</td>
                <td>省份</td>
                <td>操作</td>
            </tr>
            <?php
$_from = $_smarty_tpl->tpl_vars['list']->value;
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
$_smarty_tpl->tpl_vars['v'] = new Smarty_Variable;
$_smarty_tpl->tpl_vars['v']->_loop = false;
foreach ($_from as $_smarty_tpl->tpl_vars['v']->value) {
$_smarty_tpl->tpl_vars['v']->_loop = true;
$foreach_v_Sav = $_smarty_tpl->tpl_vars['v'];
?>
            <tr>
                <td><?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
</td>
                <td><?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
</td>
                <td>
                    <?php if ($_smarty_tpl->tpl_vars['v']->value['sex'] == 0) {?>女
                    <?php } elseif ($_smarty_tpl->tpl_vars['v']->value['sex'] == 1) {?>男
                    <?php } else { ?>人妖
                    <?php }?>
                </td>
                <td><?php echo $_smarty_tpl->tpl_vars['v']->value['age'];?>
</td>
                <td><?php echo $_smarty_tpl->tpl_vars['v']->value['province'];?>
</td>
                <td class="col-md-2">
                    <a href="./index.php?c=User&a=edit&id=<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
" class="btn btn-primary">编辑</a>
                    <button onclick="del(this)">删除</button>
                </td>
            </tr>
            <?php
$_smarty_tpl->tpl_vars['v'] = $foreach_v_Sav;
}
?>
        </table>
        
    </div><!--END container-->
    

    <?php echo '<script'; ?>
 src="./public/js/jquery.min.js"><?php echo '</script'; ?>
>
    <?php echo '<script'; ?>
 src="./public/js/bootstrap.min.js"><?php echo '</script'; ?>
>
</body>
<?php echo '<script'; ?>
>
    function del(obj){
      
        var id =  $(obj).parent().parent().children(':eq(0)').html();
       $.ajax({
         type:'get',
         url:'index.php?c=User&a=del',
         data:{id:id},
         success:function(e){
            if(e==1){
                  $(obj).parent().parent().remove(); 
            }else{
                alert('删除失败');
            }
         }
       });
       
    }

<?php echo '</script'; ?>
>
</html><?php }
}
?>